#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 100005;
int n, m;
int a[N], dat[N * 4];
void build(int u, int l, int r){
    if(l == r) {
        dat[u] += a[l];
    } else{
        int mid = (l + r) / 2;
        build (u * 2, l, mid);
        build (u * 2 + 1, mid + 1, r);
        dat[u] += dat[u * 2];
		dat[u] += dat[u * 2 + 1];
    }
}
int query (int u, int nowl, int nowr, int l, int r) {
    int val = 0x7fffffff;
    if(l <= nowl && r >= nowr){
        val += dat[u];
    } else {
        int mid = (nowl + nowr) / 2;
        if(l <= mid) {
        	val += query (u * 2 , nowl, mid, l, r);
		}
        if(r > mid) {
        	val += query (u * 2 + 1, mid + 1, nowr, l, r);
		}
    }
    return val;
}

int main() {
    scanf("%d%d", &n);
    for (int i = 1; i <= n; i++) {
    	scanf("%d", &a[i]);
	}
    build (1, 1, n);
    scanf ("%d", &m);
    int x, y;
	for (int i = 1; i <= m; i++) {
		scanf ("%d%d", &x, &y);
		double d;
		d = 3.14 * (double)(query (1, 1, n, x, y));
		printf ("%2.lf\n", d);
	}
}
